function PubSub() {
    const subs = new Map();

    function subscribe(key, cb) {
        subs.set(key, cb);
        return key;
    }

    function publish(key, ...args) {
        const cb = subs.get(key);
        cb(key, ...args)
    }

    function unsubscribe(key) {
        subs.delete(key);
    }

    return {
        subscribe,
        publish,
        unsubscribe
    }
}

export default new PubSub();
console.log(11);
